package com.wenlin.myproduction.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.Expose;

import java.util.List;

public class ActivityBean implements Parcelable {

    @Expose
    public int Id;
    //20210115 新增参数 以下
    @Expose
    public int ActivityType;//1：销售活动；2：产品运营活动；4：金币活动
    @Expose
    public int JoinType;//1：兑奖券兑换；2：钻石兑奖；4：任务兑奖
    @Expose
    public int JoinTypeValue;//当JoinType=1时，这个参数表示消耗兑换券数量。当JoinType=2时，这个参数表示消耗钻石数量。当JoinType等于4时即任务兑奖时，这个参数表示具体的任务列表。1：完成今日阅读；2：完成打卡分享；4：完成头条观看；8：完成电影院观看；16：完成宠物喂养
    @Expose
    public int CashType;//1：随机抽奖；2：指定奖品；4：盲盒奖品
    @Expose
    public boolean AdCanClose;//广告可关闭按钮
    @Expose
    public boolean GiftCanRepeat;//奖品是否可重复
    @Expose
    public String AdBigPic;//大图
    @Expose
    public String AdSmallPic;//小图
    @Expose
    public String AdUrl;//点击广告跳转地址
    @Expose
    public String AdDescribe;//广告描述
    @Expose
    public int CashTypeTask;//1：今日阅读；2：打卡分享；4：头条观看；8：电影院观看；16：宠物喂养；32：占位
    @Expose
    public DailyTaskBean DailyTask;
    //20210115 新增参数 以上
    @Expose
    public String GoodId;
    @Expose
    public boolean EnrollFlag;//是否已经参加过了
    @Expose
    public String ActivityName;
    @Expose
    public int DisplayType;//活动展示形式  1弹窗  2banner 3=1+2就是弹窗和banner两者都有
    @Expose
    public int PositionType;//活动展示位置 1首页  2个人中心
    @Expose
    public boolean NeedEnroll;//报名参与  0不需要  1需要报名
    @Expose
    public int ShowBeforeMin;
    @Expose
    public long BeginTime;
    @Expose
    public long EndTime;
    @Expose
    public List<ActivityGiftBean> GiftList;

    public ActivityBean() {
    }

    public static class DailyTaskBean implements Parcelable {
        public static final Creator<DailyTaskBean> CREATOR = new Creator<DailyTaskBean>() {
            @Override
            public DailyTaskBean createFromParcel(Parcel source) {
                return new DailyTaskBean(source);
            }

            @Override
            public DailyTaskBean[] newArray(int size) {
                return new DailyTaskBean[size];
            }
        };
        @Expose
        public boolean DrawFlag;
        @Expose
        public boolean UseFlag;
        @Expose
        public int Progress;

        public DailyTaskBean() {
        }

        protected DailyTaskBean(Parcel in) {
            this.DrawFlag = in.readByte() != 0;
            this.UseFlag = in.readByte() != 0;
            this.Progress = in.readInt();
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeByte(this.DrawFlag ? (byte) 1 : (byte) 0);
            dest.writeByte(this.UseFlag ? (byte) 1 : (byte) 0);
            dest.writeInt(this.Progress);
        }
    }

    public static class ActivityGiftBean implements Parcelable {
        @Expose
        public int Id;
        @Expose
        public long ActiveStart;
        @Expose
        public long ActiveEnd;
        @Expose
        public String GiftCoupon;//奖品兑换券
        @Expose
        public String AdvertisePic;//广告图
        @Expose
        public int GiftId;
        @Expose
        public int GiftType;//0：虚拟礼品；1：实体礼品
        @Expose
        public String GiftName;//奖品名字
        @Expose
        public String GiftPic;//奖品图片
        //自己加的 以下
        public int CouponCount;
        public android.graphics.Bitmap Bitmap;
        public boolean Selected;
        public boolean first;
        public boolean last;
        public int actId;

        //自己加的 以上
        public ActivityGiftBean() {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.Id);
            dest.writeLong(this.ActiveStart);
            dest.writeLong(this.ActiveEnd);
            dest.writeString(this.GiftCoupon);
            dest.writeString(this.AdvertisePic);
            dest.writeInt(this.GiftId);
            dest.writeInt(this.GiftType);
            dest.writeString(this.GiftName);
            dest.writeString(this.GiftPic);
            dest.writeInt(this.CouponCount);
            dest.writeParcelable(this.Bitmap, flags);
            dest.writeByte(this.Selected ? (byte) 1 : (byte) 0);
            dest.writeByte(this.first ? (byte) 1 : (byte) 0);
            dest.writeByte(this.last ? (byte) 1 : (byte) 0);
            dest.writeInt(this.actId);
        }

        protected ActivityGiftBean(Parcel in) {
            this.Id = in.readInt();
            this.ActiveStart = in.readLong();
            this.ActiveEnd = in.readLong();
            this.GiftCoupon = in.readString();
            this.AdvertisePic = in.readString();
            this.GiftId = in.readInt();
            this.GiftType = in.readInt();
            this.GiftName = in.readString();
            this.GiftPic = in.readString();
            this.CouponCount = in.readInt();
            this.Bitmap = in.readParcelable(android.graphics.Bitmap.class.getClassLoader());
            this.Selected = in.readByte() != 0;
            this.first = in.readByte() != 0;
            this.last = in.readByte() != 0;
            this.actId = in.readInt();
        }

        public static final Creator<ActivityGiftBean> CREATOR = new Creator<ActivityGiftBean>() {
            @Override
            public ActivityGiftBean createFromParcel(Parcel source) {
                return new ActivityGiftBean(source);
            }

            @Override
            public ActivityGiftBean[] newArray(int size) {
                return new ActivityGiftBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.Id);
        dest.writeInt(this.ActivityType);
        dest.writeInt(this.JoinType);
        dest.writeInt(this.JoinTypeValue);
        dest.writeInt(this.CashType);
        dest.writeByte(this.AdCanClose ? (byte) 1 : (byte) 0);
        dest.writeByte(this.GiftCanRepeat ? (byte) 1 : (byte) 0);
        dest.writeString(this.AdBigPic);
        dest.writeString(this.AdSmallPic);
        dest.writeString(this.AdUrl);
        dest.writeString(this.AdDescribe);
        dest.writeInt(this.CashTypeTask);
        dest.writeParcelable(this.DailyTask, flags);
        dest.writeString(this.GoodId);
        dest.writeByte(this.EnrollFlag ? (byte) 1 : (byte) 0);
        dest.writeString(this.ActivityName);
        dest.writeInt(this.DisplayType);
        dest.writeInt(this.PositionType);
        dest.writeByte(this.NeedEnroll ? (byte) 1 : (byte) 0);
        dest.writeInt(this.ShowBeforeMin);
        dest.writeLong(this.BeginTime);
        dest.writeLong(this.EndTime);
        dest.writeTypedList(this.GiftList);
    }

    protected ActivityBean(Parcel in) {
        this.Id = in.readInt();
        this.ActivityType = in.readInt();
        this.JoinType = in.readInt();
        this.JoinTypeValue = in.readInt();
        this.CashType = in.readInt();
        this.AdCanClose = in.readByte() != 0;
        this.GiftCanRepeat = in.readByte() != 0;
        this.AdBigPic = in.readString();
        this.AdSmallPic = in.readString();
        this.AdUrl = in.readString();
        this.AdDescribe = in.readString();
        this.CashTypeTask = in.readInt();
        this.DailyTask = in.readParcelable(DailyTaskBean.class.getClassLoader());
        this.GoodId = in.readString();
        this.EnrollFlag = in.readByte() != 0;
        this.ActivityName = in.readString();
        this.DisplayType = in.readInt();
        this.PositionType = in.readInt();
        this.NeedEnroll = in.readByte() != 0;
        this.ShowBeforeMin = in.readInt();
        this.BeginTime = in.readLong();
        this.EndTime = in.readLong();
        this.GiftList = in.createTypedArrayList(ActivityGiftBean.CREATOR);
    }

    public static final Creator<ActivityBean> CREATOR = new Creator<ActivityBean>() {
        @Override
        public ActivityBean createFromParcel(Parcel source) {
            return new ActivityBean(source);
        }

        @Override
        public ActivityBean[] newArray(int size) {
            return new ActivityBean[size];
        }
    };
}
